<?php

	/**
	 * @see Bike_Model_Mapper_Abstract
	 */
	require_once 'Bike/Model/Mapper/Abstract.php';
	
	/**
	 * @see Bike_Model_Mapper_Dependence
	 */
	require_once 'Bike/Model/Mapper/Dependence.php';
	
	
	class Bike_Model_Mapper_Item extends Bike_Model_Mapper_Abstract
	{
		const DB_TABLE_NAME = 'item';
		const DB_TABLE_PK_NAME = 'item_id';
		const DB_TABLE_ALIAS = 'i';

		static public function getInstance()
	    {
	        return self::_getInstance(__CLASS__);
	    }

	    public function getDefaultValues()
	    {	    	return array(
	    		'status_id' => $this->getStatusIdActive(),
	    		'date_create' => time(),
	    		'date_update' => time(),
	    	);
	    }

	    protected function _getDependences()
	    {
	    	return array(
	    		$this->createDependence(array(
					'type' => Bike_Model_Mapper_Dependence::JOIN_LEFT,
					'name' => 'status',
					'mapperClass' => 'Bike_Model_Mapper_Status',
					'parentJoinFields' => array('status_id'),
				)),
				$this->createDependence(array(
					'type' => Bike_Model_Mapper_Dependence::JOIN_LEFT,
					'name' => 'module',
					'mapperClass' => 'Bike_Model_Mapper_Module',
					'parentJoinFields' => array('module_id'),
				)),
	    	);
	    }
	}
